<!DOCTYPE html>
<head>
    <meta charset="utf-8">
    <title>登录</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    {css href="__STATIC__/layui/css/layui.css" /}
    {css href="__STATIC__/admin/css/style.css" /}
    {js href="__STATIC__/jquery.js" /}
    {js href='__STATIC__/layui/layui.js' /}
</head>
<body>
<!-- 用户登录 -->
<style>
    .layui-form-item .layui-input-inline {
        margin: 0 0 10px 0px
    }
</style>
<div class="login-main" id="login" style="position: inherit;">
    <header class="layui-elip">后台登录</header>
    <form class="layui-form" id="loginform">
        <div class="layui-form-item">
            <div class="layui-input-inline">
                <input name="user_name" lay-verify="required" placeholder="请输入登录用户名"  type="text" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-inline">
                <input name="password" lay-verify="required" placeholder="请输入登录密码"  type="password" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-row">
                <div class="layui-col-md5">
                    <input name="verify" lay-verify="required" placeholder="请输入验证码"  type="text" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-col-md6">
                    <img src="{:url('verify')}" onclick="this.src='{:url('verify')}?'+Math.random();">
                </div>
            </div>
        </div>
        <div class="layui-input-inline login-btn">
            <button type="submit" lay-submit="" lay-filter="login" class="layui-btn">登录</button>
        </div>
    </form>
</div>

<script>
    layui.use('form', function(){
        var form = layui.form;
        form.on('submit(login)', function(data){
            $.post(
                "{:url('Login/index')}",
                data.field,
                function(obj) {
                    if(obj.code == 200){
                        layer.msg(obj.msg,{icon:1,time:2000},function () {
                            location.href="{:url('mp/Mp/index')}";
                        });
                    }else {
                        layer.alert(obj.msg);
                    }
                },
                "json"
            );
            return false;
        });
    });
</script>
</body>
</html>
